;;; -*-  Base: 10; Mode: LISP; Package: USER; Syntax: Common-Lisp; -*-

(in-package :user)

;; Common Lisp version of Dectalk

(unless (find-package 'dectalk)
  (make-package 'dectalk :use '(lisp)))

;;; Sun Nov 27 00:08:00 PST 1994 wab
;;; Define which type of synthesizer is being used
;;; a Dectalk Express  'express
;;; a Multivoice       'multivoice
;;; comment out the ones not used.
;(pushnew 'multivoice *features*) ;uncomment for Multivoice
;;;(pushnew 'express *features*) ;uncomment for Dectalk Express


;;; Variable: *ANNOUNCE*                                     Author: raman
;;; Created: Sat Dec  5 12:30:50 1992
;;; set to nil if dectalk not connected 
(defvar *announce* nil     "If t announce actions on dectalk")

;;; Function: ANNOUNCE                                       Author: raman
;;; Created: Tue Sep  1 19:40:28 1992

(defun announce (announcement) 
  "If dectalk ready announce it on dectalk "
  (when (and *announce* 
         (find-package 'dectalk)
             (find :dectalk  *features*))
    (dectalk::speak-string announcement)
    )
  )

;;; Variable: *DECTALK-PATHNAME*                             Author: raman
;;; Created: Mon Mar 30 20:13:56 1992

(defvar *dectalk-pathname*
  (concatenate 'string  *lisp-code-directory* "/" "synthesizer")
  "directory where multivoice code kept.")

(defun multivoice-test () 
  "test if everything for multivoice loaded and running."
  (when   (find-package 'dectalk)
    (dectalk::setup)
    ;(dectalk::speak-string "Sending test index.")
    ;(dectalk::await-silence)
    ;(dectalk::speak-string "The index was received or await-silence timed out.")
    ;(dectalk::speak-string "multivoice ready to talk from lisp.")
    )
  )

(defsystem DECTALK
    :source-pathname(concatenate 'string
                                 *lisp-code-directory* "/" "synthesizer")
    :package dectalk
    :finally-do (multivoice-test)
    :components (
		 (:file "serial")
		 (:file "dectalk"
			:depends-on (serial))
		 (:file "smart-talker"
			:depends-on ( read-out-into-file))
                 (:file "read-out-into-file")
		 )
:finally-do 
(defun announce (announcement) 
(dectalk::send-string announcement))
    )

(defun announce (announcement) 
  (when (find-package :dectalk) 
    (funcall 
 (find-symbol "SPEAK-STRING" :dectalk) 
             announcement )))

